<?
if (!defined('baseinfo')) {
    exitdata();
}   
?>
<script>
var isedit=1;
var initmsg=0;
var searchTxtSugg="";
 var userdatasetfollowcheck='<?=$data['userdata']['userid']?>';
</script>
<script src="<?=baseinfo?>/js/scriptsubmain.js"></script>
<script>
$( document ).ready(function() { 
 <? 
 if($data['templatemessages'])
 {
 ?>
 setmessage();
 <? if($data['msgstatus']){?>
 
  var jqxhr=setstatusmessage(<?=$data['msgstatus']?>);
  jqxhr.done(function() 
              {
              setmsgrowdata(<?=$data['msgto']?>);
              });
 <?}else{?>
 setstatusmessage(1);
 <?}?>
 
 var tempheightscroll=0;;
  var tempnewheightscroll=0;;
 $('.wrpInMsgArea').scroll(function(){
      if(initmsg==1)
      {
      var div = $(this);

      
      if(div.scrollTop() == 0)
        {
              
          //console.log("Scroll");
              tempheightscroll=0;
              $('.dateMsg').each(function( index ) {
               tempheightscroll+=$(this).height();
              });
              
              var jqxhr= prependmessagelist();
              jqxhr.done(function() 
              {
              //console.log(tempheightscroll);
             
              tempnewheightscroll=0;   
              $('.dateMsg').each(function( index ) {
                 tempnewheightscroll+=$(this).height();
              });
              
              
              
               if(nodatafound==0)
              {
              div.scrollTop(tempnewheightscroll-tempheightscroll);
              }
              
            //  console.log(div[0].scrollHeight);
             // console.log($('.wrpInMsgArea').height());
              });
            //console.log("Reached the top!");
        }
      }
});
 
 <?
 
 }
 else if($data['templatefollow']){
  if( $data['userdata']['countrequest']==0&&$data['userdata']['countfollower']==0&&$data['userdata']['countfollowing']==0&&$data['userdata']['countblock']==0){?>
 
 
 <?}else{?>
 

 setfollow();
 var jqxhr =rowfollow();
 jqxhr.done(function() {});
 
 <?}?>
 <? }
 else if($data['templatesuggetion'])
 {
 
 ?>
 setsuggetionfriend();
 rowsuggetion();
 
 $("#wrpOutSrchBox").submit(function() {
    fsearchsuggetion(); 
    
});




 
 <?
 if($data['fconnect'])
 {
 
 

 ?>
 setfsuggetionfriend();
  $("#wrpOutSrchfBox").submit(function() {
    ffsearchsuggetion(); 
    
});
 rowfsuggetion();
 <?
  }
 
 }
 else if(($data['userdata']['checkfollow']===false||$data['userdata']['checkfollow']===3)&&$data['userdata']['publish']==0&&$data['userdata']['userid']!=$data['user']['userid']){?>
 setprivate();
 <?}
 else{?>
 //return false; 
 $(".wrpCell.mainCell").html('');
 <? if($data['tag']&&$data['tagsearch']==""){?>
  var jqxhr =gettagproduct();
  <?}else{?>
  var jqxhr =getmainproduct();
  <?}?>

  jqxhr.done(function() {
               // console.log("Test");
         $('.wrpInMid.w960').bind('scroll', function()
                              {
                                if($(this).scrollTop() + 
                                   $(this).innerHeight()
                                   >= $(this)[0].scrollHeight)
                                {
                                  
                                  if(enddata==0)
                                  {
                                    enddata=1;
                                    pagemain++;
                                    <? if($data['tag']&&$data['tagsearch']==""){?>
                                    var jqxhr2 =gettagproduct();
                                    <?}else{?>
                                    var jqxhr2 =getmainproduct();
                                    <?}?>
                                    jqxhr.done(function() {
                                    enddata=0;
                                    });
                                    //console.log('end reached');
                                  
                                  }
                                  
                                }
                              })
                              
         });
         
  <?}?>
 
 
 });

 function setsuggetionfriend()
 {
 
 var code = '<div class="wrpSgtFrnd clBd2 bdFull">\n';
code += '<div class="wrpHdSgtFrnd clBd1 bdBtm clTxt2 fs03">\n';
code += '<span>Friends Suggestion</span>\n';
code += '<form class="wrpOutSrchBox" id="wrpOutSrchBox" onsubmit="return false;" >\n';
code += '<div class="wrpSrchBox">\n';
code += '<input type="text" placeholder="Search" id="searchsuggestion" class="srchBox clBg4 fs01 clTxt3">\n';
code += '<div class="btnIco srchGen" onclick="fsearchsuggetion()">\n';
code += '<span class="ico icoSrchGen"></span>\n';
code += '</div>\n';
code += '</div>\n';
code += '</form>\n';
code += '</div>\n';

code += '<div id="listSuggestion">\n';


//code += '<div class="wrpOutInvtFrnd clBd2 bdBtm">\n';
//code += '<div class="wrpInvtFrnd wrpInvtUser">\n';
//code += '<img height="24" width="24" alt="img" src="img/dfthmbuser.jpg" class="genImgUser">\n';
//code += '<span class="genNameUser cutTxt clTxt2 fs03">Alextra Fadas</span>\n';
//code += '</div>\n';
//code += '<div class="wrpBtnSgtFrnd">\n';
//code += '<div title="Follow" class="btnIco flwGen clBgBt1">\n';
//code += '<span class="ico icoFlwPl icoFlw"></span>\n';
//code += '</div>\n';
//code += '<div title="Message" class="btnIco flwGen clBgBt1">\n';
//code += '<span class="ico icoMsgGen"></span>\n';
//code += '</div>\n';
//code += '</div>\n';
//code += '</div>\n';



code += '</div>\n';

code += '<button class="btnSeeMore clTxt3 fs02" onclick="rowsuggetion()">See More</button>\n';
code += '</div>';

 $(".wrprFlwMsg").html(code);
 
 
 }
 
 
 function setfsuggetionfriend()
 {
 
 var code = '<div class="wrpSgtFrnd clBd2 bdFull">\n';
code += '<div class="wrpHdSgtFrnd clBd1 bdBtm clTxt2 fs03">\n';
code += '<span>Facebook Friend</span>\n';
code += '<form class="wrpOutSrchBox" id="wrpOutSrchfBox" onsubmit="return false;" >\n';
code += '<div class="wrpSrchBox">\n';
code += '<input type="text" placeholder="Search" id="searchfsuggestion" class="srchBox clBg4 fs01 clTxt3">\n';
code += '<div class="btnIco srchGen" onclick="ffsearchsuggetion()">\n';
code += '<span class="ico icoSrchGen"></span>\n';
code += '</div>\n';
code += '</div>\n';
code += '</form>\n';
code += '</div>\n';

code += '<div id="listfSuggestion">\n';


//code += '<div class="wrpOutInvtFrnd clBd2 bdBtm">\n';
//code += '<div class="wrpInvtFrnd wrpInvtUser">\n';
//code += '<img height="24" width="24" alt="img" src="img/dfthmbuser.jpg" class="genImgUser">\n';
//code += '<span class="genNameUser cutTxt clTxt2 fs03">Alextra Fadas</span>\n';
//code += '</div>\n';
//code += '<div class="wrpBtnSgtFrnd">\n';
//code += '<div title="Follow" class="btnIco flwGen clBgBt1">\n';
//code += '<span class="ico icoFlwPl icoFlw"></span>\n';
//code += '</div>\n';
//code += '<div title="Message" class="btnIco flwGen clBgBt1">\n';
//code += '<span class="ico icoMsgGen"></span>\n';
//code += '</div>\n';
//code += '</div>\n';
//code += '</div>\n';



code += '</div>\n';

code += '<button class="btnSeeMore clTxt3 fs02" onclick="rowfsuggetion()">See More</button>\n';
code += '</div>';

 $(".wrprFlwMsg").append(code);
 
 
 }
 
  function fsearchsuggetion()
 {
 searchTxtSugg=$("#searchsuggestion").val();
 rowpage=1;
 $('#listSuggestion').html('');
 rowsuggetion();

 
 
 }
 var searchfTxtSugg='';
   function ffsearchsuggetion()
 {
 searchfTxtSugg=$("#searchfsuggestion").val();
 rowpage=1;
 $('#listfSuggestion').html('');
 rowfsuggetion();

 
 
 }
 function rowfsuggetion()
 {
var code="";
return jshr= $.post(serviceinfo+'getfacebookuserlistbystatus', { page:rowpage,searchfTxtSugg:searchfTxtSugg }, function(data) { 
if(data.error.response)
{
alertbox(data.error.error);
}else
{
if(data['data'].length)
{
var classnow="";
var textfollownow="";
var checkrownow=1;
$.each(data['data'], function(key, value) {
 
 code='';
code += '<div id="userData-'+value.userid+'" class="wrpOutInvtFrnd clBd2 bdBtm">\n';

if(value.userid!=0)
{
code += '<div class="wrpInvtFrnd wrpInvtUser" onclick="linkto(\''+baseinfo+'/'+value.username+'\')">\n';
code += '<img width="24" height="24" alt="img" src="'+value.simgarray.newpath+'" class="genImgUser">\n';

code += '<span class="genNameUser cutTxt clTxt2 fs04">'+value.displayname+'</span>\n';

code += '</div>\n';
}else
{

code += '<div class="wrpInvtFrnd wrpInvtUser" onclick="linkto(\'http://www.facebook.com/people/'+value.displayname+'/'+value.facebookid+'\')">\n';
code += '<img width="24" height="24" alt="img" src="'+value.simgarray.newpath+'" class="genImgUser">\n';

code += '<span class="genNameUser cutTxt clTxt2 fs04">'+value.displayname+'</span>\n';

code += '</div>\n';
}

code += '<div class="wrpBtnSgtFrnd">\n';

classnow="";
textfollownow="Follow";
if(value.checkfollow==3)
{
classnow="icoFlwWaitPf";
textfollownow="Wait";
}else if(value.checkfollow)
{
classnow="icoFlwed";
textfollownow="UnFollow";
}

if(value.userid!=0)
{
code += '<div id="flwGen-'+value.userid+'" class="btnIco flwGen clBgBt1" onclick="followfunction(0,'+value.userid+')" >\n';
code += '<span title="'+textfollownow+'" class="ico icoFlwPl icoFlw '+classnow+'"></span>\n';
code += '</div>\n';
}
if(value.userid!=0)
{
code += '<div class="btnIco flwGen clBgBt1" onclick="redirectto(\''+baseinfo+'/<?=$data['userdata']['username']?>/messages?userid='+value.userid+'\')">\n';
code += '<span title="Message" class="ico icoMsgGen"></span>\n';
code += '</div>\n';
}else
{
// send invite your friend
code += '<div class="btnIco flwGen clBgBt1" >\n';
code += '<span title="Message" class="ico icoMsgGen"></span>\n';
code += '</div>\n';

}

if(setstatus==3)
{
code += '<div class="btnIco flwGen clBgBt1" onclick="acceptfollow('+value.userid+')">\n';
code += '<span title="Accept" class="ico icoAcpFlw"></span>\n';
code += '</div>\n';
}

//code += '<div class="wrpBlckRptFlw">\n';

//code += '<div class="btnIco flwGen">\n';
//code += '<span class="ico icoArwDwnFlw"></span>\n';
//code += '</div>\n';

//code += '<div class="genMenuListPop blckRptFlwPop">\n';
//code += '<div class="wrpMenuListPop">\n';

//code += '<div class="triang triGen"></div>\n';

//code += '<div class="wrpMLP">\n';

//code += '<div class="bgMLPT clBg5"></div>\n';
//code += '<div class="mLP clBg5 clTxt3 fs04">\n';
<?if($data['userdata']['userid']==$data['user']['userid']){?>
//if(setstatus!=4&&setstatus!=2)
//{
//code += '<div class="btnMLP" onclick="blockprofile('+value.userid+','+setstatus+')" >Block</div>\n';
//}else if(setstatus!=2)
//{
//code += '<div class="btnMLP" onclick="blockprofile('+value.userid+','+setstatus+')" >UnBlock</div>\n';

//}
<?}?>

//code += '<div class="btnMLP" onclick="openreport(3,0,'+value.userid+')">Report</div>\n';
//code += '</div>\n';
//code += '<div class="bgMLPB clBg5"></div>\n';
//code += '</div>\n';
//code += '</div>\n';
//code += '</div>\n';
//code += '</div>\n';

code += '</div>\n';
code += '</div>\n';

$('#listfSuggestion').append(code);
 checkrownow++;
 });
 if(checkrownow<20)
 {
 $('.wrpSgtFrnd .btnSeeMore.clTxt3.fs02').hide();
 }
}else
{
if(rowpage==1)
{

$('.wrpSgtFrnd').html('<span class="noFlwMsg cltxt3 fs04">----- You have all follow  -----</span>');

}


}
 
 }

rowpage++;
 });
 
 
 }
  function rowsuggetion()
 {
var code="";
return jshr= $.post(serviceinfo+'getuserlistbystatus', { page:rowpage,userid:userid,status:7,search:searchTxtSugg }, function(data) { 
if(data.error.response)
{
alertbox(data.error.error);
}else
{
if(data['data'].length)
{
var classnow="";
var textfollownow="";
var checkrownow=1;
$.each(data['data'], function(key, value) {
 
 code='';
code += '<div id="userData-'+value.userid+'" class="wrpOutInvtFrnd clBd2 bdBtm">\n';
code += '<div class="wrpInvtFrnd wrpInvtUser" onclick="linkto(\''+baseinfo+'/'+value.username+'\')">\n';
code += '<img width="24" height="24" alt="img" src="'+value.simgarray.newpath+'" class="genImgUser">\n';

code += '<span class="genNameUser cutTxt clTxt2 fs04">'+value.displayname+'</span>\n';

code += '</div>\n';
code += '<div class="wrpBtnSgtFrnd">\n';

classnow="";
textfollownow="Follow";
if(value.checkfollow==3)
{
classnow="icoFlwWaitPf";
textfollownow="Wait";
}else if(value.checkfollow)
{
classnow="icoFlwed";
textfollownow="UnFollow";
}


code += '<div id="flwGen-'+value.userid+'" class="btnIco flwGen clBgBt1" onclick="followfunction(0,'+value.userid+')" >\n';
code += '<span title="'+textfollownow+'" class="ico icoFlwPl icoFlw '+classnow+'"></span>\n';
code += '</div>\n';


code += '<div class="btnIco flwGen clBgBt1" onclick="redirectto(\''+baseinfo+'/<?=$data['userdata']['username']?>/messages?userid='+value.userid+'\')">\n';
code += '<span title="Message" class="ico icoMsgGen"></span>\n';
code += '</div>\n';

if(setstatus==3)
{
code += '<div class="btnIco flwGen clBgBt1" onclick="acceptfollow('+value.userid+')">\n';
code += '<span title="Accept" class="ico icoAcpFlw"></span>\n';
code += '</div>\n';
}

//code += '<div class="wrpBlckRptFlw">\n';

//code += '<div class="btnIco flwGen">\n';
//code += '<span class="ico icoArwDwnFlw"></span>\n';
//code += '</div>\n';

//code += '<div class="genMenuListPop blckRptFlwPop">\n';
//code += '<div class="wrpMenuListPop">\n';

//code += '<div class="triang triGen"></div>\n';

//code += '<div class="wrpMLP">\n';

//code += '<div class="bgMLPT clBg5"></div>\n';
//code += '<div class="mLP clBg5 clTxt3 fs04">\n';
<?if($data['userdata']['userid']==$data['user']['userid']){?>
//if(setstatus!=4&&setstatus!=2)
//{
//code += '<div class="btnMLP" onclick="blockprofile('+value.userid+','+setstatus+')" >Block</div>\n';
//}else if(setstatus!=2)
//{
//code += '<div class="btnMLP" onclick="blockprofile('+value.userid+','+setstatus+')" >UnBlock</div>\n';

//}
<?}?>

//code += '<div class="btnMLP" onclick="openreport(3,0,'+value.userid+')">Report</div>\n';
//code += '</div>\n';
//code += '<div class="bgMLPB clBg5"></div>\n';
//code += '</div>\n';
//code += '</div>\n';
//code += '</div>\n';
//code += '</div>\n';

code += '</div>\n';
code += '</div>\n';

$('#listSuggestion').append(code);
 checkrownow++;
 });
 if(checkrownow<20)
 {
 $('.wrpSgtFrnd .btnSeeMore.clTxt3.fs02').hide();
 }
}else
{
if(rowpage==1)
{

$('.wrpSgtFrnd').html('<span class="noFlwMsg cltxt3 fs04">----- You have all follow  -----</span>');

}


}
 
 }

rowpage++;
 });
 
 
 }
 function blockprofile(userid,status)
 {
 
  if(userid)
{
loaddata();
 $.post(serviceinfo+'blockuser', { userid:userid,status:status }, function(data) { 
 loadclosedata();
 if(data.error.response)
{
if(data.error.error[0].code==5)
{
$('.ovlPopLd').hide();
$('.wrpPopLI').fadeIn();

//console.log('test');
}else
{
alertbox(data.error.error);
}
}
else
{
var data=data.data;
$("#userData-"+userid).remove();
$('#tgFlwHdGen4 span').html(data.countblock);

}
 
 });
 
}
 
 }
 function setprivate()
 {
 var code = '<div class="shwEmt pvAcntLk cltxt3 fs04 ">\n';
code += '<p>\'<span><? echo mysql_real_escape_string($data['userdata']['displayname']);?></span>\' is private.<br>Request to follow him.</p>\n';
code += '<div class="btnIco flwEmt clBgBt1" onclick="followfunction(0,<? echo $data['userdata']['userid'];?>);">\n';
code += '<span class="ico icoFlwPl icoFlw <?php if($data['userdata']['checkfollow']==3){echo "icoFlwWaitPf";} else if($data['userdata']['checkfollow']){ echo "icoFlwed"; }?>"></span>\n';
code += '</div>\n';
code += '</div>';

 $(".wrpCell.mainCell").html(code);
 
 }
 function openfullprofile()
 {
 $('.wrpPopFullPf').fadeIn();
 
 
  if($("#mylat").val()!=""&&$("#mylng").val()!="")
  {
 setTimeout(function(){
 
 
   var code ='<a href="http://maps.google.com/?q='+$("#mylat").val()+','+$("#mylng").val()+'" target="_blank"><img width="100%" height="250" src="http://maps.googleapis.com/maps/api/staticmap?center='+$("#mylat").val()+','+$("#mylng").val()+'&zoom=17&size=500x250&markers='+$("#mylat").val()+','+$("#mylng").val()+'&sensor=true" ></a>';
   
   $('.wrpMapAdrs.clBd2.bdFull').html(code);
//var latLng={lat:$("#mylat").val(),lng:$("#mylng").val()};

// $('.wrpMapAdrs.clBd2.bdFull').gmap3({
//                  marker:{ 
//                    latLng:latLng,
//                    options:{
//                        draggable: false
//                    }
//                    },
//                      map:{
//                        options:{
//                          zoom: 15,
//                          center :latLng
//                        }
//                      }
//                });
 
 
 
 },2000);
  }
  
  
      $(".popPf").mCustomScrollbar({
    advanced:{
    autoScrollOnFocus: false,
    updateOnContentResize: true

  },
  mouseWheelPixels: 300 //change this to a value, that fits your needs
});
 
 }
 var rowpage=1;
 var setstatus='<?=$data['templatefollow']?>';
 var userdatasetmsg='<?=$data['user']['userid']?>';
 function acceptfollow(userid)
 {
 if(userid)
{
loaddata();
 $.post(serviceinfo+'acceptuser', { userid:userid }, function(data) { 
 loadclosedata();
 if(data.error.response)
{
if(data.error.error[0].code==5)
{
$('.ovlPopLd').hide();
$('.wrpPopLI').fadeIn();

//console.log('test');
}else
{
alertbox(data.error.error);
}
}
else
{
var data=data.data;
$("#userData-"+userid).remove();
$('#tgFlwHdGen3 span').html(data.countrequest);

}
 
 });
 
}
 
 
 
 }

 function rowfollow()
 {
var code="";
return jshr= $.post(serviceinfo+'getuserlistbystatus', { page:rowpage,userid:userid,status:setstatus }, function(data) { 
if(data.error.response)
{
alertbox(data.error.error);
}else
{
if(data['data'].length)
{
var classnow="";
var checkrownow=1;
var textfollowset="";
$.each(data['data'], function(key, value) {
 
 code='';
code += '<div id="userData-'+value.userid+'" class="wrpOutLstFlwMsg clBd2 bdBtm">\n';
code += '<div class="wrpInLstFlw" onclick="linkto(\''+baseinfo+'/'+value.username+'\')">\n';
code += '<img width="32" height="32" alt="img" src="'+value.simgarray.newpath+'" class="genImgUser">\n';

code += '<span class="genNameUser cutTxt clTxt2 fs04">'+value.displayname+'</span>\n';

code += '</div>\n';
code += '<div class="wrpBtnFlw">\n';

classnow="";
textfollowset="Follow";
if(value.checkfollow==3)
{
classnow="icoFlwWaitPf";
textfollowset="Wait";
}else if(value.checkfollow)
{
classnow="icoFlwed";
textfollowset="UnFollow";
}


code += '<div id="flwGen-'+value.userid+'" class="btnIco flwGen clBgBt1" onclick="followfunction(0,'+value.userid+')" >\n';
code += '<span title="'+textfollowset+'" class="ico icoFlwPl icoFlw '+classnow+'"></span>\n';
code += '</div>\n';


code += '<div class="btnIco flwGen clBgBt1" onclick="redirectto(\''+baseinfo+'/<?=$data['userdata']['username']?>/messages?userid='+value.userid+'\')">\n';
code += '<span title="Message" class="ico icoMsgGen"></span>\n';
code += '</div>\n';

if(setstatus==3)
{
code += '<div class="btnIco flwGen clBgBt1" onclick="acceptfollow('+value.userid+')">\n';
code += '<span title="Accept" class="ico icoAcpFlw"></span>\n';
code += '</div>\n';
}

code += '<div class="wrpBlckRptFlw">\n';
code += '<div class="btnIco flwGen">\n';
code += '<span class="ico icoArwDwnFlw"></span>\n';
code += '</div>\n';
code += '<div class="genMenuListPop blckRptFlwPop">\n';
code += '<div class="wrpMenuListPop">\n';
code += '<div class="triang triGen"></div>\n';
code += '<div class="wrpMLP">\n';
code += '<div class="bgMLPT clBg5"></div>\n';
code += '<div class="mLP clBg5 clTxt3 fs04">\n';
<?if($data['userdata']['userid']==$data['user']['userid']){?>
if(setstatus!=4&&setstatus!=2)
{
code += '<div class="btnMLP" onclick="blockprofile('+value.userid+','+setstatus+')" >Block</div>\n';
}else if(setstatus!=2)
{
code += '<div class="btnMLP" onclick="blockprofile('+value.userid+','+setstatus+')" >UnBlock</div>\n';

}
<?}?>

code += '<div class="btnMLP" onclick="openreport(3,0,'+value.userid+')">Report</div>\n';
code += '</div>\n';
code += '<div class="bgMLPB clBg5"></div>\n';
code += '</div>\n';
code += '</div>\n';
code += '</div>\n';
code += '</div>\n';
code += '</div>\n';
code += '</div>\n';

$('.wrpLstFlw .btnSeeMore.clTxt3.fs02').before(code);
 checkrownow++;
 });
 if(checkrownow<20)
 {
 $('.wrpLstFlw .btnSeeMore.clTxt3.fs02').hide();
 }
}else
{
if(rowpage==1)
{

$('.wrpLstFlw').html('<span class="noFlwMsg cltxt3 fs04">----- You are not follow anyone. -----</span>');

}


}
 
 }

rowpage++;
 });
 
 
 }
 function setstatusfollow(statusset)
 {
 setstatus=statusset;
 rowpage=1;
 $('.wrpLstFlw').html('<button class="btnSeeMore clTxt3 fs02" onclick="rowfollow()">See More</button>');
 $('.tgFlwHdGen').removeClass('clSp2');
 $('#tgFlwHdGen'+statusset).addClass('clSp2');
 rowfollow();
 
 
 }
 function setfollow()
 {
 var code = '';
 code += '<div class="wrpFlw clBd2 bdFull">\n';
 code += '<div class="wrpFlwHd">\n';
 code += '<div class="wrpTgHdGen clBd1 bdBtm clTxt2 fs03">\n';

 <?if($data['userdata']['userid']==$data['user']['userid']){?>
 code += '<div id="tgFlwHdGen3" onclick="setstatusfollow(3);" class="tgFlwHdGen tgCl clBd1 bdR <? if($data['templatefollow']==3){ echo "clSp2";}?>"><span><?=$data['userdata']['countrequest']?></span><br>Requests</div>\n';
 <?}?>
 
 code += '<div id="tgFlwHdGen1" onclick="setstatusfollow(1);" class="tgFlwHdGen tgCl clBd1 bdR <? if($data['templatefollow']==1){ echo "clSp2";}?> "><span><?=$data['userdata']['countfollower']?></span><br>Followers</div>\n';
 code += '<div id="tgFlwHdGen2" onclick="setstatusfollow(2);" class="tgFlwHdGen tgCl clBd1 bdR <? if($data['templatefollow']==2){ echo "clSp2";}?>"><span><?=$data['userdata']['countfollowing']?></span><br>Following</div>\n';
 
 <?if($data['userdata']['userid']==$data['user']['userid']){?>
 code += '<div id="tgFlwHdGen4" onclick="setstatusfollow(4);" class="tgFlwHdGen tgCl clBd1 <? if($data['templatefollow']==4){ echo "clSp2";}?>"><span><?=$data['userdata']['countblock']?></span><br>Block</div>\n';
  <?}?>
  
 code += '</div>\n';
 //code += '<div class="btnIco wrpFlwAllGen flwAllFlw clBgBt1 fs02">\n';
 //code += '<span title="Delete All" class="ico icoDelGen"></span>\n';
//code += '<span class="flwTxtAll">All</span>\n';
//code += '</div>\n';
code += '</div>\n';

code += '<div class="wrprOutLstFlw">\n';
code += '<div class="wrpLstFlw">\n';







code += '<button class="btnSeeMore clTxt3 fs02" onclick="rowfollow()">See More</button>\n';
code += '</div>\n';
code += '</div>\n';

code += '</div>\n';


 $(".wrprFlwMsg").html(code);
 
 }
 var setmsgto='<?=$data['msgto']?>';
 var status
 function checknewmessage()
 {
        if(setintevaldata)
        {
        setintevaldata=window.clearInterval(setintevaldata);
        }
        return jshr= $.post(serviceinfo+'checkupdatemessage', { userid:chatnowdata,msgid:lastmsgid }, function(data) { 

        if(data.data.checknewmessage)
        {
        setmsgrowdata(chatnowdata);
        }else
        {
        setintevaldata=self.setInterval(function(){checknewmessage()},5000);
        }
       // setintevaldata=self.setInterval(function(){checknewmessage()},5000);
        });
 
 }
 function setmessage()
 {
 
 var code = '';
code += '<div class="wrprMsg clearfix">\n';
code += '<div class="wrpLstUserMsg">\n';
code += '<div class="wrpTgHdGen clBd2 bdBtm clTxt2 fs03">\n';
code += '<span id="tgHdGen1" onclick="setstatusmessage(1);" class="tgHdGen tgCl clBd2 bdR">Followers</span>\n';
code += '<span id="tgHdGen2" onclick="setstatusmessage(2);" class="tgHdGen tgCl clBd2 bdR">Following</span>\n';
code += '<span id="tgHdGen6" onclick="setstatusmessage(6);" class="tgHdGen tgCl ">Others</span>\n';
code += '</div>\n';
code += '<div class="lstUserMsg clBd2 bdBtm">\n';
code += '</div>\n';
code += '</div>\n';
code += '<div class="wrprMsgArea clBd2 bdFull">\n';
code += '<div class="wrpUnderMsgArea">\n';
code += '<div class="topMsgArea clBg2">\n';
code += '<span class="btnBackMsg"></span>\n';
code += '<span class="txtMsgArea">Message</span>\n';
code += '</div>\n';
code += '<div class="wrpInMsgArea">\n';
code += '</div>\n';
code += '<form class="wrpInpMsg clBg4" onsubmit="return sendmsgnow()">\n';
code += '<div class="addMsg">\n';

//code += '<div title="Browse" class="btnIco addImgTl clBd3 bdR">\n';
//code += '<span class="ico icoAddImgTl"></span>\n';
//code += '<div class="wrpUlFile">\n';
//code += '<input type="file" class="ulFile">\n';
//code += '</div>\n';
//code += '</div>\n';

//code += '<div title="Cloud" class="btnIco addCldTl">\n';
//code += '<span class="ico icoAddCldTl"></span>\n';
//code += '</div>\n';

code += '</div>\n';
code += '<div title="Send" class="btnIco sendMsg" onclick="sendmsgnow()">\n';
code += '<span class="ico icoSendMsg"></span>\n';
code += '</div>\n';
code += '<input type="text" id="msgtextbox" placeholder="Type Here" class="inpMsg clBg4 fs03 clTxt2">\n';
code += '</form>\n';
code += '</div>\n';
code += '</div>\n';
code += '</div>\n';

$(".wrprFlwMsg").html(code);

 
 }
 function sendmsgnow()
 {
 if(setintevaldata)
        {
        setintevaldata=window.clearInterval(setintevaldata);
        }
 if($('#msgtextbox').val())
 {
 loaddata();
 $.post(serviceinfo+'sendmsg', { msg:$('#msgtextbox').val(),userid:chatnowdata }, function(data) { 
 loadclosedata();
 $('#msgtextbox').val('');

 
 setmsgrowdata(chatnowdata);

 
 });
 }
 return false;
 }
 var chatnowdata='';
 var pagerowchat=1;
 var setintevaldata;
 var lastmsgid=0;
 function setmsgrowdata(userid)
 {
        if(setintevaldata)
        {
        setintevaldata=window.clearInterval(setintevaldata);
        }
        lastmsgid=0;
        $('.wrpOutLstMsg').removeClass('msgAtv');
        $('#wrpOutLstMsg-'+userid).addClass('msgAtv');
   
      chatnowdata=userid;
      pagerowchat=1;
      var jqxhr= rowmessagelist();
      
      jqxhr.done(function() {
      $(".wrpInMsgArea").scrollTop($(".wrpInMsgArea")[0].scrollHeight);
      initmsg=1;
      setintevaldata=self.setInterval(function(){checknewmessage()},5000);
      });
 
 }
 function rowmessagelist()
 {
   return jshr= $.post(serviceinfo+'getmsglist', { userid:chatnowdata,page:pagerowchat }, function(data) { 
    if(data.error.response)
    {
    alertbox(data.error.error);
    }else
    {
    $('.wrpInMsgArea').html('');
    if(data['data'].length)
    {
       var code="";
       var tempdata="";
       var tempdatasetmsg="";
       var closedata=0;
       var rowdatatemp=0;
       var checklastmsg2=0;
         $.each(data['data'], function(key, value) {
         
        if(checklastmsg2==0)
        {
        lastmsgid=value.msgid;
        checklastmsg2=1;
        }
        
        
        if(value.newdate!=tempdata)
        {
        code="";
        tempdata=value.newdate;
        code += '<div class="dateMsg">\n';
        code += '<div class="hdMsgArea clearfix clBd2 bdBtm clTxt2 fs03 boldGen">\n';
        code += '<span>'+value.newdate+'</span>\n';
        code += '</div>\n';
        code += '<div class="wrpMsgArea" id="msgid-'+value.newdateid+'">\n';
        tempdatasetmsg="";
        
        }
        
        tempdatasetmsg = '<div class="msgArea">\n<div class="wrpNameTimeMsg">\n<span class="genNameUser cutTxt clTxt2 fs03">'+value.fromuser.displayname+'</span><br>\n<span class="clTxt3 fs01">'+value.newtime+'</span>\n</div>\n<div class="userMsg clTxt3 fs02">\n<span>'+value.msg+'</span>\n</div>\n</div>'+tempdatasetmsg;
        
        if(typeof(data['data'][rowdatatemp+1])=== "undefined")
        {
        code +=tempdatasetmsg;
        code += '</div>\n';
        code += '</div>';
        $('.wrpInMsgArea').prepend(code);
        }else
        {
        if(data['data'][rowdatatemp+1].newdate!=tempdata)
        {
        code +=tempdatasetmsg;
        code += '</div>\n';
        code += '</div>';
        $('.wrpInMsgArea').prepend(code);
        }
        
        }
        
        rowdatatemp++;
        
        });
         
    pagerowchat++;
    }

    }
   
   
   });
 
 }
 function isScrolledIntoView(elem)
{
    var docViewTop = $(window).scrollTop();
    var docViewBottom = docViewTop + $(window).height();

    var elemTop = $(elem).offset().top;
    var elemBottom = elemTop + $(elem).height();
    var checkdata=((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
    
    console.log(checkdata);
    return checkdata;
}
 var nodatafound=0;
 function prependmessagelist()
 {
 
 return jshr= $.post(serviceinfo+'getmsglist', { userid:chatnowdata,page:pagerowchat }, function(data) { 
 if(data.error.response)
    {
    alertbox(data.error.error);
    }else
    {
    if(data['data'].length)
    {
    var code="";
    var tempdata="";
    var tempdatasetmsg="";
    var closedata=0;
    var rowdatatemp=0;
    $.each(data['data'], function(key, value) {
    
    if ($('#msgid-'+value.newdateid).length > 0 ) {
   // console.log(1);
    tempdatasetmsg = '<div class="msgArea">\n<div class="wrpNameTimeMsg">\n<span class="genNameUser cutTxt clTxt2 fs03">'+value.fromuser.displayname+'</span><br>\n<span class="clTxt3 fs01">'+value.newtime+'</span>\n</div>\n<div class="userMsg clTxt3 fs02">\n<span>'+value.msg+'</span>\n</div>\n</div>';

    $('#msgid-'+value.newdateid).prepend(tempdatasetmsg);
    
     code="";
     tempdata="";
     tempdatasetmsg="";
     closedata=0;
    // rowdatatemp=0;
    
    }else
    {
   // console.log(2);
     if(value.newdate!=tempdata)
        {
            //console.log(3);
        code="";
        tempdata=value.newdate;
        code += '<div class="dateMsg">\n';
        code += '<div class="hdMsgArea clearfix clBd2 bdBtm clTxt2 fs03 boldGen">\n';
        code += '<span>'+value.newdate+'</span>\n';
        code += '</div>\n';
        code += '<div class="wrpMsgArea" id="msgid-'+value.newdateid+'">\n';
        tempdatasetmsg="";
        
        }
        
        tempdatasetmsg = '<div class="msgArea">\n<div class="wrpNameTimeMsg">\n<span class="genNameUser cutTxt clTxt2 fs03">'+value.fromuser.displayname+'</span><br>\n<span class="clTxt3 fs01">'+value.newtime+'</span>\n</div>\n<div class="userMsg clTxt3 fs02">\n<span>'+value.msg+'</span>\n</div>\n</div>'+tempdatasetmsg;
        
        if(typeof(data['data'][rowdatatemp+1])=== "undefined")
        {
        code +=tempdatasetmsg;
        code += '</div>\n';
        code += '</div>';
      //  console.log(1);
        //console.log(code);
        $('.wrpInMsgArea').prepend(code);
        }else
        {
        if(data['data'][rowdatatemp+1].newdate!=tempdata)
        {
        code +=tempdatasetmsg;
        code += '</div>\n';
        code += '</div>';
      //  console.log(2);
     //   console.log(code);
        $('.wrpInMsgArea').prepend(code);
        }
        
        }
        
        
    
    
    
    
    }
    rowdatatemp++;
    
    
    });
    pagerowchat++;
    nodatafound=0;
    }
    else
    {
    
    nodatafound=1;
    
    }
    }
 
 });
 
 
 }
 function rowmessage()
 {
 return jshr= $.post(serviceinfo+'getuserlistbystatus', { page:rowpage,userid:userdatasetmsg,status:setstatus }, function(data) { 
 
 if(data.error.response)
{
alertbox(data.error.error);
}else
{
if(data['data'].length)
{
 var code="";
 $.each(data['data'], function(key, value) {
code += '<div class="wrpOutLstMsg" id="wrpOutLstMsg-'+value.userid+'" onclick="setmsgrowdata('+value.userid+')">\n';
code += '<div class="wrpInLstMsg">\n';
code += '<img width="32" height="32" alt="img" src="'+value.simgarray.newpath+'" class="genImgUser">\n';
code += '<div class="wrpLstNameTimeMsg">\n';
code += '<span class="genNameUser cutTxt clTxt2 fs04">'+value.displayname+'</span><br>\n';
code += '<span class="clTxt3 fs01">'+value.newupdatedate+'</span>\n';
code += '</div>\n';
code += '</div>\n';
code += '</div>';

 });
 
 $('.lstUserMsg.clBd2.bdBtm').append(code);

}
}
 
 
 });
 
 
 }
 function setstatusmessage(statusset,userid)
 {
 lastmsgid=0;
 if(setintevaldata)
        {
        setintevaldata=window.clearInterval(setintevaldata);
        }
 setstatus=statusset;
 rowpage=1;
 initmsg=0;
 $('.wrpInMsgArea').html('');
 $('.tgHdGen').removeClass('clSp2');
 $('#tgHdGen'+statusset).addClass('clSp2');
 $('.lstUserMsg.clBd2.bdBtm').html('');
 
 return rowmessage();
 
 }
 
</script>
<div class="ovlPopGen wrpPopFullPf" >
    <div class="popGen posPop popPf">
        <div class="topGen clBd2 bdBtm">
            <div class="wrpTtlGen">
                <h1 class="ttlGen clTxt2 fs05">Full Profile</h1>
            </div>
            <div class="btnIco closeGen" onclick="$('.wrpPopFullPf').fadeOut()">
                <span class="ico icoCloseGen"></span>
            </div>
            <div class="topBgGen clBg3"></div>
        </div>
        <div class="bodyGen clBg3">
            <div class="bodyOutGen">
                <div class="bodyFullPf">
                    <div class="wrpAllInfo">
                        <div class="wrpGenInfo">
                            <div class="wrpHdInfoGen mgBtm10">
                                <h2 class="ttlFullPf clTxt2 fs04">General</h2>
                            </div>
                            <table class="tbGenInfo tbPopFullPf clTxt3 fs03">
                                <tbody>
                                <tr>
                                    <th>Display Name</th>
                                    <td><?  if($data['userdata']['displayname']){echo $data['userdata']['displayname'];}else{ echo "N/A";};?></td>
                                </tr>
                                <tr>
                                    <th>First Name</th>
                                    <td><?  if($data['userdata']['firstname']){echo $data['userdata']['firstname'];}else{ echo "N/A";}; ?></td>
                                </tr>
                                <tr>
                                    <th>Last Name</th>
                                    <td><?  if($data['userdata']['lastname']){echo $data['userdata']['lastname'];}else{ echo "N/A";}; ?></td>
                                </tr>
                                <tr>
                                    <th>Level</th>
                                    <td><? echo "N/A"; ?></td>
                                </tr>
                                <tr>
                                    <th>Gender</th>
                                    <td><? if($data['userdata']['gender']==1){echo "Male";}else if($data['userdata']['gender']==2){echo "Female";}else{ echo "N/A";}; ?></td>
                                </tr>
                                <tr>
                                    <th>Date of Birth</th>
                                    <td><? if($data['userdata']['birthdate']!="0000-00-00"){ list($year,$month,$day)=explode("-",$data['userdata']['birthdate']); echo $day.' / '.$month.' / '.$year; }else{ echo "N/A"; }?></td>
                                </tr>
                                <tr>
                                    <th>Description</th>
                                    <td><? if($data['userdata']['description']){echo $data['userdata']['description'];}else{ echo "N/A"; }?></td>
                                </tr>
                            </tbody></table>
                        </div>
                        <div class="wrpAdrsInfo">
                            <div class="wrpHdInfoGen mgBtm10">
                                <h2 class="ttlFullPf clTxt2 fs04">Address</h2>
                            </div>
                            <div class="tbPopFullPf">
                                <div class="adrsInfo clTxt3 fs03">
                                    <p> <? if($data['userdata']['address']){ echo $data['userdata']['address']."<br>"; }?><? if($data['userdata']['countryid']==210){  if($data['userdata']['tumname']){ echo $data['userdata']['tumname'].', ';}   if($data['userdata']['disname']){ echo $data['userdata']['disname'].', ';}     }  if($data['userdata']['state']){ echo  $data['userdata']['state'].",<br>"; }?> <?=$data['userdata']['countryname']?> <?=$data['userdata']['code']?></p>
                                </div>
                                <div class="wrpMapAdrs clBd2 bdFull">
                                    <div class="mapAdrs"></div>
                                    <div class="icoDefFullPf">
                                        <span class="ico icoMapDefFullPf"></span>
                                        <span>Map</span>
                                    </div>
                                </div>
                                <input type="hidden" name="mylat" id="mylat" value="<? if($data['userdata']['lat']!="0.000000000000000"&&$data['userdata']['lat']!=0){ echo $data['userdata']['lat'];}?>">
                                <input type="hidden" name="mylng" id="mylng" value="<? if($data['userdata']['lng']!="0.000000000000000"&&$data['userdata']['lat']!=0){ echo $data['userdata']['lng'];}?>">
                            </div>
                        </div>
                        <div class="wrpCtcInfo">
                            <div class="wrpHdInfoGen mgBtm10">
                                <h2 class="ttlFullPf clTxt2 fs04">Contact</h2>
                            </div>
                            <table class="tbGenInfo tbPopFullPf clTxt3 fs03">
                                <tbody>
                               
                                <tr>
                                    <th>Facebook</th>
                                    <td> <? if($data['userdata']['facebook']){?><a target="_blank" href="<?php if(strpos($data['userdata']['facebook'],"http")===false){$data['userdata']['facebook']='http://'.$data['userdata']['facebook'];} echo $data['userdata']['facebook'];?>"><?=$data['userdata']['facebook']?></a><? }else{ echo "N/A";  }?></td>
                                </tr>
                                    
                                    
                                <tr>
                                    <th>Twitter</th>
                                    <td><? if($data['userdata']['twitter']){?><a target="_blank" href="<?php if(strpos($data['userdata']['twitter'],"http")===false){$data['userdata']['twitter']='http://'.$data['userdata']['twitter'];} echo $data['userdata']['twitter'];?>"><?=$data['userdata']['twitter']?></a><? }else{ echo "N/A";  }?></td>
                                </tr>
                                
                               
                                <tr>
                                    <th>Google+</th>
                                    <td> <? if($data['userdata']['googleplus']){?>   <a target="_blank" href="<?php if(strpos($data['userdata']['googleplus'],"http")===false){$data['userdata']['googleplus']='http://'.$data['userdata']['googleplus'];} echo $data['userdata']['googleplus'];?>"><?=$data['userdata']['googleplus']?></a><? }else{ echo "N/A";  }?></td>
                                </tr>
                                
                              
                                <tr>
                                    <th>Website</th>
                                    <td>  <? if($data['userdata']['website']){?><a target="_blank" href="<?php if(strpos($data['userdata']['website'],"http")===false){$data['userdata']['website']='http://'.$data['userdata']['website'];} echo $data['userdata']['website'];?>"><?=$data['userdata']['website']?></a><? }else{ echo "N/A";  }?></td>
                                </tr>
                                
                                <?if($data['userdata']['hideemail']=='0') {?>
                                
                                <tr>
                                    <th>Email</th>
                                    <td><?php if($data['userdata']['emailcontact']){ echo $data['userdata']['emailcontact'];} else{ echo "N/A";  }?></td>
                                </tr>
                                
                                <?}
                                if($data['userdata']['hidephone']=='0') {?>
                                
                                <tr>
                                    <th>Phone</th>
                                    <td> <? if($data['userdata']['phone']){?><?php echo $data['userdata']['phone']; ?><? }else{ echo "N/A";  }?></td>
                                </tr>
                              <?}
                              if($data['userdata']['hidefax']=='0') {
                              ?>
                                <tr>
                                    <th>Fax</th>
                                    <td><? if($data['userdata']['fax']){?><?php echo $data['userdata']['fax']; ?> <? }else{ echo "N/A";  }?></td>
                                </tr>
                                <?}
                                if($data['userdata']['hideetc']=='0') {
                                ?>
                                 
                                <tr>
                                    <th>ETC</th>
                                    <td><? if($data['userdata']['etc']){?><?php echo $data['userdata']['etc']; ?><? }else{ echo "N/A";  }?></td>
                                </tr>
                                 <?}?>
                            </tbody></table>
                        </div>    
                    </div>                
                </div>
                <div class="wrpBtnExpnPop">
                    <button class="btnGen btnOk clTxtW cutTxt clBgBt1 fs04">OK</button>
                </div>
            </div>
        </div>
    </div>
 </div>
